#include <stdio.h>
int main()
{
    int num;
    while( scanf("%d", &num) != EOF ){
        int result = 0;
        int count = 0;
        while( num ){
            result *= 10;
            result += num % 10;
            num /= 10;
            count++;
        }
        if(count != 5)
            printf("not permitted\n");
        else
            printf("%d\n", result);
    }
    return 0;
}